package com.buba.pojo;

import lombok.Data;

import java.util.List;

@Data
public class Pagination<T> {
    private long pageNow;//当前页
    private long limit;//每页条数
    private long pageCount;//总条数
    private  long pageTotal;//总页数
    private List<T> list;//结果列表

    // 计算当前页数
    public long computeIndex(){
        long index = (pageNow - 1) * limit;
        return index;
    }

    public void computePageTotal(){
        if (pageCount % limit == 0){
            this.pageTotal = pageCount/limit;
        }else {
            this.pageTotal = pageCount/limit+1;
        }
    }
}
